package com.dcy.znoa.common.util.wj;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * wj 三元一次方程  八元二次方程组
 * Created by pengyu on 2018/4/13.
 */
public class HouseWJ {

//    public static void main(String[] args) {
//
//        A: for (;;) {
//            int max = 100;
////            int min = -100;
//            int min = 0;
//            for (int x = min; x < max; x++) {
//                for (int y = min; y < max; y++) {
//                    for (int z = min; z < max; z++) {
////                        if (y == 2 * x - 7 && 5 * x + 3 * y + 2 * z == 3 && 3 * x + z == 7) {
//                        if (35*x + 6*y+ 12*z == 300) {
//                            System.out.println("x=" + x + "\ty=" + y + "\tz=" + z);
////                            break A;
//                            continue ;
//                        }
//                    }
//                }
//            }
//            max+=100;//扩大范围
//            min-=100;//扩大范围
//        }
//
//    }

    public static void main(String[] args) {

//        int min = 0;
//        B:
//        for (int x = min; x < 10; x++) {
//            for (int y = min; y < 51; y++) {
//                for (int z = min; z < 26; z++) {
//                    if (35 * x + 6 * y + 12 * z == 300) {
//                        System.out.println("x=" + x + " y=" + y + " z=" + z);
//                    }
//                }
//            }
//        }

//        getHuiZhengList(35, 6, 12, 300);

//        //400 270 440 150 171060 9706
//        getDongCengList(400, 270, 440, 150, 171060, 9700);
//        getDongCengList0618_8(420, 400, 400, 270, 171060, 9700);
//        getDongCengList0618_12(420, 400, 400, 270,440,150 ,171060, 9700);

//        getDongCengList0620_1(420, 400, 400, 270, 171060, 9700);
//        getDongCengList0620_2(420, 400, 400, 270, 171060 -3200, 9700);
//        getDongCengList0624_2(420, 400, 400, 270, (171060 -3200)*100, 9706*100);
//        getDongCengList0626_1(420, 400, 400, 270, 171060, 9700);
        getDongCengList0627_1_c(420, 400, 270, 150, 171060, 9706);
        /*
        420X1Y1+400X2Y2+400X3Y3+270X4Y4+440X5Y5+150X6Y6+1*1*3200 ≤ 171060；——此为计容面积约束 167860
        420/2*Y1+0*Y2+400Y3+270Y4 +440Y5+150Y6+3200 ≤9706；——此为基地面积约束
        最低层数 ≤ Xi ≤最高层数，i=1,2,3,4,5,6；——此为层数限制
        Xi ≥ 0，i=1,2,3,4,5,6。——此为理论模型的要求
        ※求出来的值若不为整数，请只保留小数点后2位
        * */
//        getDongCengList0611(420, 400, 400, 270, 440, 150, (171060 - 3200), (9700 - 3200));
//        getDongCengList0612(420, 400, 400, 270, 440, 150, (171060), (9706));

//        for(int i=2;i<=5;i++){
//            for(int j=3;j<=6;j++)
//            System.out.println("asd");
//        }

    }


    public static void writeToFile2(String content) {
        try {
//            String content = "测试使用字符串";
            File file = new File("d:/fangdichan.txt");
            //文件不存在时候，主动创建文件。
            if (!file.exists()) {
                file.createNewFile();
            }
            FileWriter fw = new FileWriter(file, true);//true为追加
            BufferedWriter bw = new BufferedWriter(fw);
            bw.write(content);
            bw.close();
            fw.close();
            System.out.println("test2 done!");

        } catch (Exception e) {
        }
    }

    public static List<HuiZheng> getHuiZhengList(int x, int y, int z, int total) {
        if (x <= 0 || y <= 0 || z <= 0 || total <= 0) {
            return null;
        }
        List<HuiZheng> list = new ArrayList<HuiZheng>();
//        int xNo,yNo,zNo;
        int xMax, yMax, zMax;
        xMax = total % x == 0 ? total / x : total / x + 1;
        yMax = total % y == 0 ? total / y : total / y + 1;
        zMax = total % z == 0 ? total / z : total / z + 1;
        int min = 0;
        for (int xNo = min; xNo <= xMax; xNo++) {//xMax = 10
            for (int yNo = min; yNo <= yMax; yNo++) {//51
                for (int zNo = min; zNo <= zMax; zNo++) {//26
                    if (x * xNo + y * yNo + z * zNo == 300) {//x= 35
                        System.out.println("xNo=" + xNo + " yNo=" + yNo + " zNo=" + zNo);
                        writeToFile2("xNo=" + xNo + " yNo=" + yNo + " zNo=" + zNo + "\r\n");
                        list.add(new HuiZheng(xNo, yNo, zNo));
//                            break A;
//                        continue;
                    }
                }
            }
        }
        return list;
    }

    //刚好公式里面第一个和第二个 都是一样的 400 270 440 150 ，所以暂时不需要设置  y1 y2 y3 y4 的参数  x层数 y栋数
    public static List<DongCeng> getDongCengList(int x1y1, int x2y2, int x3y3, int x4y4, int bigTotal, int smallTotal) {
        //简单点，没做数据校验
        System.out.println("startTime = " + new Date());
        writeToFile2("startTime = " + new Date() + "\r\n");
        List<DongCeng> list = new ArrayList<>();
        int x1Max, x2Max, x3Max, x4Max, y1Max, y2Max, y3Max, y4Max;
        int x1Min, x2Min, x3Min, x4Min;
        x1Max = 33;
        x1Min = 18;
        x2Max = 18;
        x2Min = 11;
        x3Max = 18;
        x3Min = 11;
        x4Max = 4;
        x4Min = 1;
//        x1Max = bigTotal%x1y1==0?bigTotal/x1y1:bigTotal/x1y1+1;
//        x2Max = bigTotal%x2y2==0?bigTotal/x2y2:bigTotal/x2y2+1;
//        x3Max = bigTotal%x3y3==0?bigTotal/x3y3:bigTotal/x3y3+1;
//        x4Max = bigTotal%x4y4==0?bigTotal/x4y4:bigTotal/x4y4+1;
        y1Max = smallTotal % x1y1 == 0 ? smallTotal / x1y1 : smallTotal / x1y1 + 1;
        y2Max = smallTotal % x2y2 == 0 ? smallTotal / x2y2 : smallTotal / x2y2 + 1;
        y3Max = smallTotal % x3y3 == 0 ? smallTotal / x3y3 : smallTotal / x3y3 + 1;
        y4Max = smallTotal % x4y4 == 0 ? smallTotal / x4y4 : smallTotal / x4y4 + 1;

        System.out.println("y1Max = " + y1Max);
        System.out.println("y2Max = " + y2Max);
        System.out.println("y3Max = " + y3Max);
        System.out.println("y4Max = " + y4Max);
//        long count = (x1Max - x1Min) * (x2Max - x2Min) * (x3Max - x3Min) * (x4Max - x4Min) * y1Max * y2Max * y3Max * y4Max;
//
//        System.out.println("循环次数 = "+ count);

//        int minX = 1;
        int minY = 0;
        long countNum = 0;
        int countTotal = 0;
        int result = 0;
        int x1R = 0, x2R = 0, x3R = 0, x4R = 0, y1R = 0, y2R = 0, y3R = 0, y4R = 0;
        int stR = 0, btR = 0;
        for (int x1No = x1Min; x1No <= x1Max; x1No++) {//xMax = 10
            for (int x2No = x2Min; x2No <= x2Max; x2No++) {
                for (int x3No = x3Min; x3No <= x3Max; x3No++) {
                    for (int x4No = x4Min; x4No <= x4Max; x4No++) {
                        for (int y1No = minY; y1No <= y1Max; y1No++) {
                            for (int y2No = minY; y2No <= y2Max; y2No++) {
                                for (int y3No = minY; y3No <= y3Max; y3No++) {
                                    for (int y4No = minY; y4No <= y4Max; y4No++) {
                                        countNum = countNum + 1L;
                                        if (countNum % 1000000000 == 0) {
                                            System.out.println("循环次数为：" + countNum);
                                        }
//                                        System.out.println("循环次数为："+ ++countNum);
//                                        ++countNum;
                                        int st = x1y1 * y1No + x2y2 * y2No + x3y3 * y3No + x4y4 * y4No;
                                        int bt = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No;
                                        if ((st == smallTotal) &&
                                                (bt == bigTotal)
                                                ) {//x= 35
//                                            System.out.println("x1No=" + x1No + " y1No=" + y1No +
//                                                    "x2No=" + x2No + " y2No=" + y2No +
//                                                    "x3No=" + x3No + " y3No=" + y3No +
//                                                    "x4No=" + x4No + " y4No=" + y4No);
                                            countTotal++;
                                            writeToFile2("x1=" + x1No + " y1=" + y1No +
                                                    " x2=" + x2No + " y2=" + y2No +
                                                    " x3=" + x3No + " y3=" + y3No +
                                                    " x4=" + x4No + " y4=" + y4No +
                                                    " st=" + st + " bt=" + bt +
                                                    "\r\n");
//                                            list.add(new DongCeng(x1No, x2No, x3No, x4No, y1No, y2No, y3No, y4No));
                                            int resultTemp = x1No * y1No * 400 * 7000 + x2No * y2No * 270 * 8000 + x3No * y3No * 440 * 8000 + x4No * y4No * 150 * 12000 ;
                                            if (resultTemp > result) {
                                                result = resultTemp;
                                                x1R = x1No;
                                                x2R = x2No;
                                                x3R = x3No;
                                                x4R = x4No;
                                                y1R = y1No;
                                                y2R = y2No;
                                                y3R = y3No;
                                                y4R = y4No;
                                                stR = x1y1  * y1No +  x2y2 * y2No + x3y3 * y3No + x4y4 * y4No;
                                                btR = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        writeToFile2("x1R=" + x1R + " y1R=" + y1R +
                " x2R=" + x2R + " y2R=" + y2R +
                " x3R=" + x3R + " y3R=" + y3R +
                " x4R=" + x4R + " y4R=" + y4R +
                " stR=" + stR + " btR=" + btR +
                " result=" + result + "\r\n");
        System.out.println("总次数 = " + countTotal);
        System.out.println("endTime = " + new Date());
        writeToFile2("总次数 = " + countTotal + "\r\n");
        writeToFile2("endTime = " + new Date() + "\r\n");
        return list;
    }

    //带底商
    public static List<DongCeng> getDongCengList0611(int x1y1, int x2y2, int x3y3, int x4y4, int x5y5, int x6y6, int bigTotal, int smallTotal) {
        //简单点，没做数据校验
        System.out.println("startTime = " + new Date());
        writeToFile2("startTime = " + new Date() + "\r\n");
        List<DongCeng> list = new ArrayList<>();
        int xMin, xMax;
        int y1Max, y2Max, y3Max, y4Max, y5Max, y6Max;
        xMax = 6;
        xMin = 1;
        y1Max = (smallTotal / 2) % x1y1 == 0 ? (smallTotal / 2) / x1y1 : (smallTotal / 2) / x1y1 + 1;
        y2Max = bigTotal % x2y2 == 0 ? bigTotal / x2y2 : bigTotal / x2y2 + 1;
        y3Max = smallTotal % x3y3 == 0 ? smallTotal / x3y3 : smallTotal / x3y3 + 1;
        y4Max = smallTotal % x4y4 == 0 ? smallTotal / x4y4 : smallTotal / x4y4 + 1;
        y5Max = smallTotal % x5y5 == 0 ? smallTotal / x5y5 : smallTotal / x5y5 + 1;
        y6Max = smallTotal % x6y6 == 0 ? smallTotal / x6y6 : smallTotal / x6y6 + 1;


        System.out.println("y1Max = " + y1Max);
        System.out.println("y2Max = " + y2Max);
        System.out.println("y3Max = " + y3Max);
        System.out.println("y4Max = " + y4Max);
        System.out.println("y5Max = " + y5Max);
        System.out.println("y6Max = " + y6Max);
//        long count = (x1Max - x1Min) * (x2Max - x2Min) * (x3Max - x3Min) * (x4Max - x4Min) * y1Max * y2Max * y3Max * y4Max;
//
//        System.out.println("循环次数 = "+ count);

//        int minX = 1;
        int minY = 0;
        long countNum = 0;
        int countTotal = 0;
        for (int x1No = xMin; x1No <= xMax; x1No++) {//xMax = 10
            for (int x2No = xMin; x2No <= xMax; x2No++) {
                for (int x3No = xMin; x3No <= xMax; x3No++) {
                    for (int x4No = xMin; x4No <= xMax; x4No++) {
                        for (int x5No = xMin; x5No <= xMax; x5No++) {
                            for (int x6No = xMin; x6No <= xMax; x6No++) {
                                for (int y1No = minY; y1No <= y1Max; y1No++) {
                                    for (int y2No = minY; y2No <= y2Max; y2No++) {
                                        for (int y3No = minY; y3No <= y3Max; y3No++) {
                                            for (int y4No = minY; y4No <= y4Max; y4No++) {
                                                for (int y5No = minY; y5No <= y5Max; y5No++) {
                                                    for (int y6No = minY; y6No <= y6Max; y6No++) {
                                                        countNum = countNum + 1L;
                                                        if (countNum % 100000000 == 0) {
                                                            System.out.println("循环次数为：" + countNum);
                                                        }
                                                        int st = x1y1 / 2 * y1No + 0 * x2y2 * y2No + x3y3 * y3No + x4y4 * y4No + x5y5 * y5No + x6y6 * y6No;
                                                        int bt = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No + x5y5 * y5No * x5No + x6y6 * y6No * x6No;
//                                                        if (  (st<= smallTotal) && (st>= (smallTotal -150)) &&
//                                                                (bt <= bigTotal) && (bt >= (bigTotal -150))   ) {
                                                        if ((st == smallTotal) &&
                                                                (bt == bigTotal)) {
                                                            System.out.println("x1No=" + x1No + " y1No=" + y1No +
                                                                    "x2No=" + x2No + " y2No=" + y2No +
                                                                    "x3No=" + x3No + " y3No=" + y3No +
                                                                    "x4No=" + x4No + " y4No=" + y4No +
                                                                    "x5No=" + x5No + " y5No=" + y5No +
                                                                    "x6No=" + x6No + " y6No=" + y6No);
                                                            countTotal++;
                                                            writeToFile2("x1=" + x1No + " y1=" + y1No +
                                                                    " x2=" + x2No + " y2=" + y2No +
                                                                    " x3=" + x3No + " y3=" + y3No +
                                                                    " x4=" + x4No + " y4=" + y4No +
                                                                    " x5=" + x5No + " y5=" + y5No +
                                                                    " x6=" + x6No + " y6=" + y6No +
                                                                    " st=" + st + " bt=" + bt +
                                                                    "\r\n");
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        System.out.println("总次数 = " + countTotal);
        System.out.println("endTime = " + new Date());
        writeToFile2("总次数 = " + countTotal + "\r\n");
        writeToFile2("endTime = " + new Date() + "\r\n");
        return list;
    }

    //无底
    public static List<DongCeng> getDongCengList0612(int x1y1, int x2y2, int x3y3, int x4y4, int x5y5, int x6y6, int bigTotal, int smallTotal) {
        //简单点，没做数据校验
        System.out.println("startTime = " + new Date());
        writeToFile2("startTime = " + new Date() + "\r\n");
        List<DongCeng> list = new ArrayList<>();
        int xMin, xMax;
        int y1Max, y2Max, y3Max, y4Max, y5Max, y6Max;
        xMax = 6;
        xMin = 1;
        y1Max = smallTotal % x1y1 == 0 ? smallTotal / x1y1 : smallTotal / x1y1 + 1;
        y2Max = smallTotal % x2y2 == 0 ? smallTotal / x2y2 : smallTotal / x2y2 + 1;
        y3Max = smallTotal % x3y3 == 0 ? smallTotal / x3y3 : smallTotal / x3y3 + 1;
        y4Max = smallTotal % x4y4 == 0 ? smallTotal / x4y4 : smallTotal / x4y4 + 1;
        y5Max = smallTotal % x5y5 == 0 ? smallTotal / x5y5 : smallTotal / x5y5 + 1;
        y6Max = smallTotal % x6y6 == 0 ? smallTotal / x6y6 : smallTotal / x6y6 + 1;


        System.out.println("y1Max = " + y1Max);
        System.out.println("y2Max = " + y2Max);
        System.out.println("y3Max = " + y3Max);
        System.out.println("y4Max = " + y4Max);
        System.out.println("y5Max = " + y5Max);
        System.out.println("y6Max = " + y6Max);
//        long count = (x1Max - x1Min) * (x2Max - x2Min) * (x3Max - x3Min) * (x4Max - x4Min) * y1Max * y2Max * y3Max * y4Max;
//
//        System.out.println("循环次数 = "+ count);

//        int minX = 1;
        int minY = 0;
        long countNum = 0;
        int countTotal = 0;
        for (int x1No = xMin; x1No <= xMax; x1No++) {//xMax = 10
            for (int x2No = xMin; x2No <= xMax; x2No++) {
                for (int x3No = xMin; x3No <= xMax; x3No++) {
                    for (int x4No = xMin; x4No <= xMax; x4No++) {
                        for (int x5No = xMin; x5No <= xMax; x5No++) {
                            for (int x6No = xMin; x6No <= xMax; x6No++) {
                                for (int y1No = minY; y1No <= y1Max; y1No++) {
                                    for (int y2No = minY; y2No <= y2Max; y2No++) {
                                        for (int y3No = minY; y3No <= y3Max; y3No++) {
                                            for (int y4No = minY; y4No <= y4Max; y4No++) {
                                                for (int y5No = minY; y5No <= y5Max; y5No++) {
                                                    for (int y6No = minY; y6No <= y6Max; y6No++) {
                                                        countNum = countNum + 1L;
                                                        if (countNum % 100000000 == 0) {
                                                            System.out.println("循环次数为：" + countNum);
                                                        }
                                                        int st = x1y1 * y1No + x2y2 * y2No + x3y3 * y3No + x4y4 * y4No + x5y5 * y5No + x6y6 * y6No;
                                                        int bt = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No + x5y5 * y5No * x5No + x6y6 * y6No * x6No;
//                                                        if (  (st<= smallTotal) && (st>= (smallTotal -150)) &&
//                                                                (bt <= bigTotal) && (bt >= (bigTotal -150))   ) {
                                                        if ((st == smallTotal) &&
                                                                (bt == bigTotal)) {
                                                            System.out.println("x1No=" + x1No + " y1No=" + y1No +
                                                                    "x2No=" + x2No + " y2No=" + y2No +
                                                                    "x3No=" + x3No + " y3No=" + y3No +
                                                                    "x4No=" + x4No + " y4No=" + y4No +
                                                                    "x5No=" + x5No + " y5No=" + y5No +
                                                                    "x6No=" + x6No + " y6No=" + y6No);
                                                            countTotal++;
                                                            writeToFile2("x1=" + x1No + " y1=" + y1No +
                                                                    " x2=" + x2No + " y2=" + y2No +
                                                                    " x3=" + x3No + " y3=" + y3No +
                                                                    " x4=" + x4No + " y4=" + y4No +
                                                                    " x5=" + x5No + " y5=" + y5No +
                                                                    " x6=" + x6No + " y6=" + y6No +
                                                                    " st=" + st + " bt=" + bt +
                                                                    "\r\n");
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        System.out.println("总次数 = " + countTotal);
        System.out.println("endTime = " + new Date());
        writeToFile2("总次数 = " + countTotal + "\r\n");
        writeToFile2("endTime = " + new Date() + "\r\n");
        return list;
    }

    //刚好公式里面第一个和第二个 400 270 440 150 ，需要设置  y1 y2 y3 y4 的参数
    public static List<DongCeng> getDongCengList0618_8(int x1y1, int x2y2, int x3y3, int x4y4, int bigTotal, int smallTotal) {
        //简单点，没做数据校验
        System.out.println("startTime = " + new Date());
        writeToFile2("startTime = " + new Date() + "\r\n");
        List<DongCeng> list = new ArrayList<>();
        int xMin, xMax;
        int y1Max, y2Max, y3Max, y4Max;
        xMax = 6;
        xMin = 1;
        y1Max = (smallTotal / 2) % x1y1 == 0 ? (smallTotal / 2) / x1y1 : (smallTotal / 2) / x1y1 + 1;
        y2Max = bigTotal % x2y2 == 0 ? bigTotal / x2y2 : bigTotal / x2y2 + 1;
        y3Max = smallTotal % x3y3 == 0 ? smallTotal / x3y3 : smallTotal / x3y3 + 1;
        y4Max = smallTotal % x4y4 == 0 ? smallTotal / x4y4 : smallTotal / x4y4 + 1;
        if (y2Max > 100) {
            y2Max = 100;
        }

        System.out.println("y1Max = " + y1Max);
        System.out.println("y2Max = " + y2Max);
        System.out.println("y3Max = " + y3Max);
        System.out.println("y4Max = " + y4Max);

        int minY = 0;
        long countNum = 0;
        int countTotal = 0;
//        X1*Y1*420*7000+X2*Y2*400*7000+X3*Y3*400*8000+X4*Y4*270*8000+X5*Y5*400*8000+X6*Y6*150*12000+1*1*3200*18000
        int result = 0;
        int x1R = 0, x2R = 0, x3R = 0, x4R = 0, y1R = 0, y2R = 0, y3R = 0, y4R = 0;
        int stR = 0, btR = 0;
        for (int x1No = xMin; x1No <= xMax; x1No++) {//xMax = 10
            for (int x2No = xMin; x2No <= xMax; x2No++) {
                for (int x3No = xMin; x3No <= xMax; x3No++) {
                    for (int x4No = xMin; x4No <= xMax; x4No++) {
                        for (int y1No = minY; y1No <= y1Max; y1No++) {
                            for (int y2No = minY; y2No <= y2Max; y2No++) {
                                for (int y3No = minY; y3No <= y3Max; y3No++) {
                                    for (int y4No = minY; y4No <= y4Max; y4No++) {
                                        countNum = countNum + 1L;
                                        if (countNum % 100000000 == 0) {
                                            System.out.println("循环次数为：" + countNum);
                                        }
                                        int st = x1y1 / 2 * y1No + 0 * x2y2 * y2No + x3y3 * y3No + x4y4 * y4No;
                                        int bt = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No;
//                                                        if (  (st<= smallTotal) && (st>= (smallTotal -150)) &&
//                                                                (bt <= bigTotal) && (bt >= (bigTotal -150))   ) {
                                        if ((st == smallTotal) &&
                                                (bt == bigTotal)) {
                                            System.out.println("x1No=" + x1No + " y1No=" + y1No +
                                                    "x2No=" + x2No + " y2No=" + y2No +
                                                    "x3No=" + x3No + " y3No=" + y3No +
                                                    "x4No=" + x4No + " y4No=" + y4No
                                            );
                                            countTotal++;
                                            writeToFile2("x1=" + x1No + " y1=" + y1No +
                                                    " x2=" + x2No + " y2=" + y2No +
                                                    " x3=" + x3No + " y3=" + y3No +
                                                    " x4=" + x4No + " y4=" + y4No +
                                                    " st=" + st + " bt=" + bt +
                                                    "\r\n");
                                            int resultTemp = x1No * y1No * 420 * 7000 + x2No * y2No * 400 * 7000 + x3No * y3No * 400 * 8000 + x4No * y4No * 270 * 8000 + 1 * 1 * 3200 * 18000;
                                            if (resultTemp > result) {
                                                result = resultTemp;
                                                x1R = x1No;
                                                x2R = x2No;
                                                x3R = x3No;
                                                x4R = x4No;
                                                y1R = y1No;
                                                y2R = y2No;
                                                y3R = y3No;
                                                y4R = y4No;
                                                stR = x1y1 / 2 * y1No + 0 * x2y2 * y2No + x3y3 * y3No + x4y4 * y4No;
                                                btR = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        writeToFile2("x1R=" + x1R + " y1R=" + y1R +
                " x2R=" + x2R + " y2R=" + y2R +
                " x3R=" + x3R + " y3R=" + y3R +
                " x4R=" + x4R + " y4R=" + y4R +
                " stR=" + stR + " btR=" + btR +
                " result=" + result + "\r\n");

        System.out.println("总次数 = " + countTotal);
        System.out.println("endTime = " + new Date());
        writeToFile2("总次数 = " + countTotal + "\r\n");
        writeToFile2("endTime = " + new Date() + "\r\n");
        return list;
    }

    public static List<DongCeng> getDongCengList0618_12(int x1y1, int x2y2, int x3y3, int x4y4, int x5y5, int x6y6, int bigTotal, int smallTotal) {
        //简单点，没做数据校验
        System.out.println("startTime = " + new Date());
        writeToFile2("startTime = " + new Date() + "\r\n");
        List<DongCeng> list = new ArrayList<>();
        int xMin, xMax;
        int y1Max, y2Max, y3Max, y4Max, y5Max, y6Max;
        xMax = 6;
        xMin = 1;
        y1Max = (smallTotal / 2) % x1y1 == 0 ? (smallTotal / 2) / x1y1 : (smallTotal / 2) / x1y1 + 1;
        y2Max = bigTotal % x2y2 == 0 ? bigTotal / x2y2 : bigTotal / x2y2 + 1;
        y3Max = smallTotal % x3y3 == 0 ? smallTotal / x3y3 : smallTotal / x3y3 + 1;
        y4Max = smallTotal % x4y4 == 0 ? smallTotal / x4y4 : smallTotal / x4y4 + 1;
        y5Max = smallTotal % x5y5 == 0 ? smallTotal / x5y5 : smallTotal / x5y5 + 1;
        y6Max = smallTotal % x6y6 == 0 ? smallTotal / x6y6 : smallTotal / x6y6 + 1;
        if (y2Max > 100) {
            y2Max = 100;
        }

        System.out.println("y1Max = " + y1Max);
        System.out.println("y2Max = " + y2Max);
        System.out.println("y3Max = " + y3Max);
        System.out.println("y4Max = " + y4Max);
        System.out.println("y5Max = " + y5Max);
        System.out.println("y6Max = " + y6Max);

        int minY = 0;
        long countNum = 0;
        int countTotal = 0;
//        X1*Y1*420*7000+X2*Y2*400*7000+X3*Y3*400*8000+X4*Y4*270*8000+X5*Y5*400*8000+X6*Y6*150*12000+1*1*3200*18000
        int result = 0;
        int x1R = 0, x2R = 0, x3R = 0, x4R = 0,  x5R = 0, x6R = 0,y1R = 0, y2R = 0, y3R = 0, y4R = 0,y5R = 0, y6R = 0;
        int stR = 0, btR = 0;
        for (int x1No = xMin; x1No <= xMax; x1No++) {//xMax = 10
            for (int x2No = xMin; x2No <= xMax; x2No++) {
                for (int x3No = xMin; x3No <= xMax; x3No++) {
                    for (int x4No = xMin; x4No <= xMax; x4No++) {
                        for (int x5No = xMin; x5No <= xMax; x5No++) {
                            for (int x6No = xMin; x6No <= xMax; x6No++) {
                                for (int y1No = minY; y1No <= y1Max; y1No++) {
                                    for (int y2No = minY; y2No <= y2Max; y2No++) {
                                        for (int y3No = minY; y3No <= y3Max; y3No++) {
                                            for (int y4No = minY; y4No <= y4Max; y4No++) {
                                                for (int y5No = minY; y5No <= y5Max; y5No++) {
                                                    for (int y6No = minY; y6No <= y5Max; y6No++) {
                                                        countNum = countNum + 1L;
                                                        if (countNum % 100000000 == 0) {
                                                            System.out.println("循环次数为：" + countNum);
                                                        }
                                                        int st = x1y1 / 2 * y1No + 0 * x2y2 * y2No + x3y3 * y3No + x4y4 * y4No+ x5y5 * y5No+ x6y6 * y6No;
                                                        int bt = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No + x5y5 * y5No * x5No + x6y6 * y6No * x6No;
//                                                        if (  (st<= smallTotal) && (st>= (smallTotal -150)) &&
//                                                                (bt <= bigTotal) && (bt >= (bigTotal -150))   ) {
                                                        if ((st == smallTotal) &&
                                                                (bt == bigTotal)) {
                                                            System.out.println("x1No=" + x1No + " y1No=" + y1No +
                                                                    "x2No=" + x2No + " y2No=" + y2No +
                                                                    "x3No=" + x3No + " y3No=" + y3No +
                                                                    "x4No=" + x4No + " y4No=" + y4No +
                                                                    "x4No=" + x5No + " y5No=" + y5No +
                                                                    "x6No=" + x6No + " y6No=" + y6No
                                                            );
                                                            countTotal++;
                                                            writeToFile2("x1=" + x1No + " y1=" + y1No +
                                                                    " x2=" + x2No + " y2=" + y2No +
                                                                    " x3=" + x3No + " y3=" + y3No +
                                                                    " x4=" + x4No + " y4=" + y4No +
                                                                    " x5=" + x5No + " y5=" + y5No +
                                                                    " x6=" + x6No + " y6=" + y6No +
                                                                    " st=" + st + " bt=" + bt +
                                                                    "\r\n");
                                                            int resultTemp = x1No * y1No * 420 * 7000 + x2No * y2No * 400 * 7000 + x3No * y3No * 400 * 8000 + x4No * y4No * 270 * 8000 + x5No*y5No*400*8000+x6No*y6No*150*12000+ 1 * 1 * 3200 * 18000;
                                                            if (resultTemp > result) {
                                                                result = resultTemp;
                                                                x1R = x1No;
                                                                x2R = x2No;
                                                                x3R = x3No;
                                                                x4R = x4No;
                                                                x5R = x5No;
                                                                x6R = x6No;
                                                                y1R = y1No;
                                                                y2R = y2No;
                                                                y3R = y3No;
                                                                y4R = y4No;
                                                                y5R = y5No;
                                                                y6R = y6No;
                                                                stR = x1y1 / 2 * y1No + 0 * x2y2 * y2No + x3y3 * y3No + x4y4 * y4No + x5y5 * y5No + x6y6 * y6No ;
                                                                btR = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No + x5y5 * y5No * x5No + x6y6 * y6No * x6No;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        writeToFile2("x1R=" + x1R + " y1R=" + y1R +
                " x2R=" + x2R + " y2R=" + y2R +
                " x3R=" + x3R + " y3R=" + y3R +
                " x4R=" + x4R + " y4R=" + y4R +
                " x5R=" + x5R + " y5R=" + y5R +
                " x6R=" + x6R + " y6R=" + y6R +
                " stR=" + stR + " btR=" + btR +
                " result=" + result + "\r\n");

        System.out.println("总次数 = " + countTotal);
        System.out.println("endTime = " + new Date());
        writeToFile2("总次数 = " + countTotal + "\r\n");
        writeToFile2("endTime = " + new Date() + "\r\n");
        return list;
    }

    //无底商 8个未知数
    public static List<DongCeng> getDongCengList0620_1(int x1y1, int x2y2, int x3y3, int x4y4, int bigTotal, int smallTotal) {
        //简单点，没做数据校验
        System.out.println("startTime = " + new Date());
        writeToFile2("startTime = " + new Date() + "\r\n");
        List<DongCeng> list = new ArrayList<>();
        int x1Max, x2Max, x3Max, x4Max, y1Max, y2Max, y3Max, y4Max;
        int x1Min, x2Min, x3Min, x4Min;
        x1Max = 33;
        x1Min = 18;
        x2Max = 18;
        x2Min = 11;
        x3Max = 18;
        x3Min = 11;
        x4Max = 4;
        x4Min = 1;
//        x1Max = bigTotal%x1y1==0?bigTotal/x1y1:bigTotal/x1y1+1;
//        x2Max = bigTotal%x2y2==0?bigTotal/x2y2:bigTotal/x2y2+1;
//        x3Max = bigTotal%x3y3==0?bigTotal/x3y3:bigTotal/x3y3+1;
//        x4Max = bigTotal%x4y4==0?bigTotal/x4y4:bigTotal/x4y4+1;
        y1Max = smallTotal % x1y1 == 0 ? smallTotal / x1y1 : smallTotal / x1y1 + 1;
        y2Max = smallTotal % x2y2 == 0 ? smallTotal / x2y2 : smallTotal / x2y2 + 1;
        y3Max = smallTotal % x3y3 == 0 ? smallTotal / x3y3 : smallTotal / x3y3 + 1;
        y4Max = smallTotal % x4y4 == 0 ? smallTotal / x4y4 : smallTotal / x4y4 + 1;

        System.out.println("y1Max = " + y1Max);
        System.out.println("y2Max = " + y2Max);
        System.out.println("y3Max = " + y3Max);
        System.out.println("y4Max = " + y4Max);
//        long count = (x1Max - x1Min) * (x2Max - x2Min) * (x3Max - x3Min) * (x4Max - x4Min) * y1Max * y2Max * y3Max * y4Max;
//
//        System.out.println("循环次数 = "+ count);

//        int minX = 1;
        int minY = 0;
        long countNum = 0;
        int countTotal = 0;
        int result = 0;
        int x1R = 0, x2R = 0, x3R = 0, x4R = 0, y1R = 0, y2R = 0, y3R = 0, y4R = 0;
        int stR = 0, btR = 0;
        for (int x1No = x1Min; x1No <= x1Max; x1No++) {//xMax = 10
            for (int x2No = x2Min; x2No <= x2Max; x2No++) {
                for (int x3No = x3Min; x3No <= x3Max; x3No++) {
                    for (int x4No = x4Min; x4No <= x4Max; x4No++) {
                        for (int y1No = minY; y1No <= y1Max; y1No++) {
                            for (int y2No = minY; y2No <= y2Max; y2No++) {
                                for (int y3No = minY; y3No <= y3Max; y3No++) {
                                    for (int y4No = minY; y4No <= y4Max; y4No++) {
                                        countNum = countNum + 1L;
                                        if (countNum % 1000000000 == 0) {
                                            System.out.println("循环次数为：" + countNum);
                                        }
//                                        System.out.println("循环次数为："+ ++countNum);
//                                        ++countNum;
                                        int st = x1y1 * y1No + x2y2 * y2No + x3y3 * y3No + x4y4 * y4No;
                                        int bt = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No;

                                        if (  (st<= smallTotal) && (st>= (smallTotal -276)) &&
                                                                (bt <= bigTotal) && (bt >= (bigTotal -270))   ) {
//                                        if ((st == smallTotal) &&
//                                                (bt == bigTotal)) {//x= 35
//                                            System.out.println("x1No=" + x1No + " y1No=" + y1No +
//                                                    "x2No=" + x2No + " y2No=" + y2No +
//                                                    "x3No=" + x3No + " y3No=" + y3No +
//                                                    "x4No=" + x4No + " y4No=" + y4No);
                                            countTotal++;
                                            writeToFile2("x1=" + x1No + " y1=" + y1No +
                                                    " x2=" + x2No + " y2=" + y2No +
                                                    " x3=" + x3No + " y3=" + y3No +
                                                    " x4=" + x4No + " y4=" + y4No +
                                                    " st=" + st + " bt=" + bt +
                                                    "\r\n");
//                                            list.add(new DongCeng(x1No, x2No, x3No, x4No, y1No, y2No, y3No, y4No));
                                            int resultTemp = x1No * y1No * 420 * 7000 + x2No * y2No * 400 * 7000 + x3No * y3No * 400 * 8000 + x4No * y4No * 270 * 8000 ;
                                            if (resultTemp > result) {
                                                result = resultTemp;
                                                x1R = x1No;
                                                x2R = x2No;
                                                x3R = x3No;
                                                x4R = x4No;
                                                y1R = y1No;
                                                y2R = y2No;
                                                y3R = y3No;
                                                y4R = y4No;
                                                stR = st;
                                                btR = bt;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        writeToFile2("x1R=" + x1R + " y1R=" + y1R +
                " x2R=" + x2R + " y2R=" + y2R +
                " x3R=" + x3R + " y3R=" + y3R +
                " x4R=" + x4R + " y4R=" + y4R +
                " stR=" + stR + " btR=" + btR +
                " result=" + result + "\r\n");
        System.out.println("总次数 = " + countTotal);
        System.out.println("endTime = " + new Date());
        writeToFile2("总次数 = " + countTotal + "\r\n");
        writeToFile2("endTime = " + new Date() + "\r\n");
        return list;
    }

    //有底商 8个未知数
    public static List<DongCeng> getDongCengList0620_2(int x1y1, int x2y2, int x3y3, int x4y4, int bigTotal, int smallTotal) {
        //简单点，没做数据校验
        System.out.println("startTime = " + new Date());
        writeToFile2("startTime = " + new Date() + "\r\n");
        List<DongCeng> list = new ArrayList<>();
        int x1Max, x2Max, x3Max, x4Max, y1Max, y2Max, y3Max, y4Max;
        int x1Min, x2Min, x3Min, x4Min;
        x1Max = 33;
        x1Min = 18;
        x2Max = 18;
        x2Min = 11;
        x3Max = 18;
        x3Min = 11;
        x4Max = 4;
        x4Min = 1;
//        x1Max = bigTotal%x1y1==0?bigTotal/x1y1:bigTotal/x1y1+1;
//        x2Max = bigTotal%x2y2==0?bigTotal/x2y2:bigTotal/x2y2+1;
//        x3Max = bigTotal%x3y3==0?bigTotal/x3y3:bigTotal/x3y3+1;
//        x4Max = bigTotal%x4y4==0?bigTotal/x4y4:bigTotal/x4y4+1;
        y1Max = (smallTotal * 2) % x1y1 == 0 ? (smallTotal * 2) / x1y1 : (smallTotal * 2) / x1y1 + 1;
        y2Max = bigTotal % x2y2 == 0 ? bigTotal / x2y2 : bigTotal / x2y2 + 1;
        y3Max = smallTotal % x3y3 == 0 ? smallTotal / x3y3 : smallTotal / x3y3 + 1;
        y4Max = smallTotal % x4y4 == 0 ? smallTotal / x4y4 : smallTotal / x4y4 + 1;
        if (y1Max > 100) {
            y1Max = 100;
        }
        if (y2Max > 100) {
            y2Max = 100;
        }
        System.out.println("y1Max = " + y1Max);
        System.out.println("y2Max = " + y2Max);
        System.out.println("y3Max = " + y3Max);
        System.out.println("y4Max = " + y4Max);
//        long count = (x1Max - x1Min) * (x2Max - x2Min) * (x3Max - x3Min) * (x4Max - x4Min) * y1Max * y2Max * y3Max * y4Max;
//
//        System.out.println("循环次数 = "+ count);

//        int minX = 1;
        int minY = 0;
        long countNum = 0;
        int countTotal = 0;
        int result = 0;
        int x1R = 0, x2R = 0, x3R = 0, x4R = 0, y1R = 0, y2R = 0, y3R = 0, y4R = 0;
        int stR = 0, btR = 0;
        for (int x1No = x1Min; x1No <= x1Max; x1No++) {//xMax = 10
            for (int x2No = x2Min; x2No <= x2Max; x2No++) {
                for (int x3No = x3Min; x3No <= x3Max; x3No++) {
                    for (int x4No = x4Min; x4No <= x4Max; x4No++) {
                        for (int y1No = minY; y1No <= y1Max; y1No++) {
                            for (int y2No = minY; y2No <= y2Max; y2No++) {
                                for (int y3No = minY; y3No <= y3Max; y3No++) {
                                    for (int y4No = minY; y4No <= y4Max; y4No++) {
                                        countNum = countNum + 1L;
                                        if (countNum % 1000000000 == 0) {
                                            System.out.println("循环次数为：" + countNum);
                                        }
//                                        System.out.println("循环次数为："+ ++countNum);
//                                        ++countNum;
                                        int st = x1y1 / 2 * y1No + 0 * x2y2 * y2No + x3y3 * y3No + x4y4 * y4No;
                                        int bt = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No;
                                        if (  (st<= smallTotal) && (st>= (smallTotal -216)) &&
                                                (bt <= bigTotal) && (bt >= (bigTotal -270))   ) {
//                                        if ((st == smallTotal) &&
//                                                (bt == bigTotal) {//x= 35
//                                            System.out.println("x1No=" + x1No + " y1No=" + y1No +
//                                                    "x2No=" + x2No + " y2No=" + y2No +
//                                                    "x3No=" + x3No + " y3No=" + y3No +
//                                                    "x4No=" + x4No + " y4No=" + y4No);
                                            countTotal++;
                                            writeToFile2("x1=" + x1No + " y1=" + y1No +
                                                    " x2=" + x2No + " y2=" + y2No +
                                                    " x3=" + x3No + " y3=" + y3No +
                                                    " x4=" + x4No + " y4=" + y4No +
                                                    " st=" + st + " bt=" + bt +
                                                    "\r\n");
//                                            list.add(new DongCeng(x1No, x2No, x3No, x4No, y1No, y2No, y3No, y4No));
                                            int resultTemp = x1No * y1No * 420 * 7000 + x2No * y2No * 400 * 7000 + x3No * y3No * 400 * 8000 + x4No * y4No * 270 * 8000 + 3200 * 18000;
                                            if (resultTemp > result) {
                                                result = resultTemp;
                                                x1R = x1No;
                                                x2R = x2No;
                                                x3R = x3No;
                                                x4R = x4No;
                                                y1R = y1No;
                                                y2R = y2No;
                                                y3R = y3No;
                                                y4R = y4No;
                                                stR = st;
                                                btR = bt;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        writeToFile2("x1R=" + x1R + " y1R=" + y1R +
                " x2R=" + x2R + " y2R=" + y2R +
                " x3R=" + x3R + " y3R=" + y3R +
                " x4R=" + x4R + " y4R=" + y4R +
                " stR=" + stR + " btR=" + btR +
                " result=" + result + "\r\n");
        System.out.println("总次数 = " + countTotal);
        System.out.println("endTime = " + new Date());
        writeToFile2("总次数 = " + countTotal + "\r\n");
        writeToFile2("endTime = " + new Date() + "\r\n");
        return list;
    }

    //有底商 8个未知数
    public static List<DongCeng> getDongCengList0624_2(int x1y1, int x2y2, int x3y3, int x4y4, int bigTotal, int smallTotal) {
        //简单点，没做数据校验
        System.out.println("startTime = " + new Date());
        writeToFile2("startTime = " + new Date() + "\r\n");
        List<DongCeng> list = new ArrayList<>();
        int x1Max, x2Max, x3Max, x4Max, y1Max, y2Max, y3Max, y4Max;
        int x1Min, x2Min, x3Min, x4Min;
        x1Max = 3300;
        x1Min = 1800;
        x2Max = 1800;
        x2Min = 1100;
        x3Max = 1800;
        x3Min = 1100;
        x4Max = 400;
        x4Min = 100;
//        x1Max = bigTotal%x1y1==0?bigTotal/x1y1:bigTotal/x1y1+1;
//        x2Max = bigTotal%x2y2==0?bigTotal/x2y2:bigTotal/x2y2+1;
//        x3Max = bigTotal%x3y3==0?bigTotal/x3y3:bigTotal/x3y3+1;
//        x4Max = bigTotal%x4y4==0?bigTotal/x4y4:bigTotal/x4y4+1;
        y1Max = (smallTotal * 2) % x1y1 == 0 ? (smallTotal * 2) / x1y1 : (smallTotal * 2) / x1y1 + 1;
        y2Max = bigTotal % x2y2 == 0 ? bigTotal / x2y2 : bigTotal / x2y2 + 1;
        y3Max = smallTotal % x3y3 == 0 ? smallTotal / x3y3 : smallTotal / x3y3 + 1;
        y4Max = smallTotal % x4y4 == 0 ? smallTotal / x4y4 : smallTotal / x4y4 + 1;
        y1Max = y1Max/100;
        y2Max = y2Max/100;
        y3Max = y3Max/100;
        y4Max = y4Max/100;
        if (y1Max > 100) {
            y1Max = 100;
        }
        if (y2Max > 100) {
            y2Max = 100;
        }
        System.out.println("y1Max = " + y1Max);
        System.out.println("y2Max = " + y2Max);
        System.out.println("y3Max = " + y3Max);
        System.out.println("y4Max = " + y4Max);
//        long count = (x1Max - x1Min) * (x2Max - x2Min) * (x3Max - x3Min) * (x4Max - x4Min) * y1Max * y2Max * y3Max * y4Max;
//
//        System.out.println("循环次数 = "+ count);

//        int minX = 1;
        int minY = 0;
        long countNum = 0;
        int countTotal = 0;
        int result = 0;
        int x1R = 0, x2R = 0, x3R = 0, x4R = 0, y1R = 0, y2R = 0, y3R = 0, y4R = 0;
        int stR = 0, btR = 0;
        for (int x1No = x1Min; x1No <= x1Max; x1No++) {//xMax = 10
            for (int x2No = x2Min; x2No <= x2Max; x2No++) {
                for (int x3No = x3Min; x3No <= x3Max; x3No++) {
                    for (int x4No = x4Min; x4No <= x4Max; x4No++) {
                        for (int y1No = minY; y1No <= y1Max; y1No++) {
                            for (int y2No = minY; y2No <= y2Max; y2No++) {
                                for (int y3No = minY; y3No <= y3Max; y3No++) {
                                    for (int y4No = minY; y4No <= y4Max; y4No++) {
                                        countNum = countNum + 1L;
                                        if (countNum % 1000000000 == 0) {
                                            System.out.println("循环次数为：" + countNum);
                                        }
//                                        System.out.println("循环次数为："+ ++countNum);
//                                        ++countNum;
                                        int st = x1y1 / 2 * y1No + 0 * x2y2 * y2No + x3y3 * y3No + x4y4 * y4No;
                                        int bt = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No;
//                                        if (  (st<= smallTotal) && (st>= (smallTotal -216)) &&
//                                                (bt <= bigTotal) && (bt >= (bigTotal -270))   ) {
                                        if ((st == smallTotal) &&
                                                (bt == bigTotal)){//x= 35
//                                            System.out.println("x1No=" + x1No + " y1No=" + y1No +
//                                                    "x2No=" + x2No + " y2No=" + y2No +
//                                                    "x3No=" + x3No + " y3No=" + y3No +
//                                                    "x4No=" + x4No + " y4No=" + y4No);
                                            countTotal++;
                                            writeToFile2("x1=" + x1No + " y1=" + y1No +
                                                    " x2=" + x2No + " y2=" + y2No +
                                                    " x3=" + x3No + " y3=" + y3No +
                                                    " x4=" + x4No + " y4=" + y4No +
                                                    " st=" + st + " bt=" + bt +
                                                    "\r\n");
//                                            list.add(new DongCeng(x1No, x2No, x3No, x4No, y1No, y2No, y3No, y4No));
                                            int resultTemp = x1No * y1No * 420 * 7000 + x2No * y2No * 400 * 7000 + x3No * y3No * 400 * 8000 + x4No * y4No * 270 * 8000 + 3200 * 18000;
                                            if (resultTemp > result) {
                                                result = resultTemp;
                                                x1R = x1No;
                                                x2R = x2No;
                                                x3R = x3No;
                                                x4R = x4No;
                                                y1R = y1No;
                                                y2R = y2No;
                                                y3R = y3No;
                                                y4R = y4No;
                                                stR = st;
                                                btR = bt;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        writeToFile2("x1R=" + x1R + " y1R=" + y1R +
                " x2R=" + x2R + " y2R=" + y2R +
                " x3R=" + x3R + " y3R=" + y3R +
                " x4R=" + x4R + " y4R=" + y4R +
                " stR=" + stR + " btR=" + btR +
                " result=" + result + "\r\n");
        System.out.println("总次数 = " + countTotal);
        System.out.println("endTime = " + new Date());
        writeToFile2("总次数 = " + countTotal + "\r\n");
        writeToFile2("endTime = " + new Date() + "\r\n");
        return list;
    }

    //无底商 8个未知数
    public static List<DongCeng> getDongCengList0626_1(int x1y1, int x2y2, int x3y3, int x4y4, int bigTotal, int smallTotal) {
        //简单点，没做数据校验
        System.out.println("startTime = " + new Date());
        writeToFile2("startTime = " + new Date() + "\r\n");
        List<DongCeng> list = new ArrayList<>();
        int x1Max, x2Max, x3Max, x4Max, y1Max, y2Max, y3Max, y4Max;
        int x1Min, x2Min, x3Min, x4Min;
        x1Max = 33;
        x1Min = 18;
        x2Max = 18;
        x2Min = 11;
        x3Max = 18;
        x3Min = 11;
        x4Max = 4;
        x4Min = 1;
//        x1Max = bigTotal%x1y1==0?bigTotal/x1y1:bigTotal/x1y1+1;
//        x2Max = bigTotal%x2y2==0?bigTotal/x2y2:bigTotal/x2y2+1;
//        x3Max = bigTotal%x3y3==0?bigTotal/x3y3:bigTotal/x3y3+1;
//        x4Max = bigTotal%x4y4==0?bigTotal/x4y4:bigTotal/x4y4+1;
        y1Max = smallTotal % x1y1 == 0 ? smallTotal / x1y1 : smallTotal / x1y1 + 1;
        y2Max = smallTotal % x2y2 == 0 ? smallTotal / x2y2 : smallTotal / x2y2 + 1;
        y3Max = smallTotal % x3y3 == 0 ? smallTotal / x3y3 : smallTotal / x3y3 + 1;
        y4Max = smallTotal % x4y4 == 0 ? smallTotal / x4y4 : smallTotal / x4y4 + 1;

        System.out.println("y1Max = " + y1Max);
        System.out.println("y2Max = " + y2Max);
        System.out.println("y3Max = " + y3Max);
        System.out.println("y4Max = " + y4Max);
//        long count = (x1Max - x1Min) * (x2Max - x2Min) * (x3Max - x3Min) * (x4Max - x4Min) * y1Max * y2Max * y3Max * y4Max;
//
//        System.out.println("循环次数 = "+ count);

//        int minX = 1;
        int minY = 0;
        long countNum = 0;
        int countTotal = 0;
        int result = 0;
        int x1R = 0, x2R = 0, x3R = 0, x4R = 0, y1R = 0, y2R = 0, y3R = 0, y4R = 0;
        int stR = 0, btR = 0;
        for (int x1No = x1Min; x1No <= x1Max; x1No++) {//xMax = 10
            for (int x2No = x2Min; x2No <= x2Max; x2No++) {
                for (int x3No = x3Min; x3No <= x3Max; x3No++) {
                    for (int x4No = x4Min; x4No <= x4Max; x4No++) {
                        for (int y1No = minY; y1No <= y1Max; y1No++) {
                            for (int y2No = minY; y2No <= y2Max; y2No++) {
                                for (int y3No = minY; y3No <= y3Max; y3No++) {
                                    for (int y4No = minY; y4No <= y4Max; y4No++) {
                                        countNum = countNum + 1L;
                                        if (countNum % 1000000000 == 0) {
                                            System.out.println("循环次数为：" + countNum);
                                        }
//                                        System.out.println("循环次数为："+ ++countNum);
//                                        ++countNum;
                                        int st = x1y1 * y1No + x2y2 * y2No + x3y3 * y3No + x4y4 * y4No;
                                        int bt = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No;

                                        if (  (st<= smallTotal) && (st>= (smallTotal -276)) &&
                                                (bt <= bigTotal) && (bt >= (bigTotal -270))   ) {
//                                        if ((st == smallTotal) &&
//                                                (bt == bigTotal)) {//x= 35
//                                            System.out.println("x1No=" + x1No + " y1No=" + y1No +
//                                                    "x2No=" + x2No + " y2No=" + y2No +
//                                                    "x3No=" + x3No + " y3No=" + y3No +
//                                                    "x4No=" + x4No + " y4No=" + y4No);
                                            countTotal++;
                                            writeToFile2("x1=" + x1No + " y1=" + y1No +
                                                    " x2=" + x2No + " y2=" + y2No +
                                                    " x3=" + x3No + " y3=" + y3No +
                                                    " x4=" + x4No + " y4=" + y4No +
                                                    " st=" + st + " bt=" + bt +
                                                    "\r\n");
//                                            list.add(new DongCeng(x1No, x2No, x3No, x4No, y1No, y2No, y3No, y4No));
                                            int resultTemp = x1No * y1No * 420 * 7000 + x2No * y2No * 400 * 7000 + x3No * y3No * 400 * 7000 + x4No * y4No * 270 * 8000 ;
                                            if (resultTemp > result) {
                                                result = resultTemp;
                                                x1R = x1No;
                                                x2R = x2No;
                                                x3R = x3No;
                                                x4R = x4No;
                                                y1R = y1No;
                                                y2R = y2No;
                                                y3R = y3No;
                                                y4R = y4No;
                                                stR = st;
                                                btR = bt;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        writeToFile2("x1R=" + x1R + " y1R=" + y1R +
                " x2R=" + x2R + " y2R=" + y2R +
                " x3R=" + x3R + " y3R=" + y3R +
                " x4R=" + x4R + " y4R=" + y4R +
                " stR=" + stR + " btR=" + btR +
                " result=" + result + "\r\n");
        System.out.println("总次数 = " + countTotal);
        System.out.println("endTime = " + new Date());
        writeToFile2("总次数 = " + countTotal + "\r\n");
        writeToFile2("endTime = " + new Date() + "\r\n");
        return list;
    }

    //无底商 8个未知数
    public static List<DongCeng> getDongCengList0627_1_c(int x1y1, int x2y2, int x3y3, int x4y4, int bigTotal, int smallTotal) {
        //简单点，没做数据校验
        System.out.println("startTime = " + new Date());
        writeToFile2("startTime = " + new Date() + "\r\n");
        List<DongCeng> list = new ArrayList<>();
        int x1Max, x2Max, x3Max, x4Max, y1Max, y2Max, y3Max, y4Max;
        int x1Min, x2Min, x3Min, x4Min;
        x1Max = 33;
        x1Min = 18;
        x2Max = 18;
        x2Min = 11;
        x3Max = 18;
        x3Min = 11;
        x4Max = 4;
        x4Min = 1;
//        x1Max = bigTotal%x1y1==0?bigTotal/x1y1:bigTotal/x1y1+1;
//        x2Max = bigTotal%x2y2==0?bigTotal/x2y2:bigTotal/x2y2+1;
//        x3Max = bigTotal%x3y3==0?bigTotal/x3y3:bigTotal/x3y3+1;
//        x4Max = bigTotal%x4y4==0?bigTotal/x4y4:bigTotal/x4y4+1;
        y1Max = smallTotal % x1y1 == 0 ? smallTotal / x1y1 : smallTotal / x1y1 + 1;
        y2Max = smallTotal % x2y2 == 0 ? smallTotal / x2y2 : smallTotal / x2y2 + 1;
        y3Max = smallTotal % x3y3 == 0 ? smallTotal / x3y3 : smallTotal / x3y3 + 1;
        y4Max = smallTotal % x4y4 == 0 ? smallTotal / x4y4 : smallTotal / x4y4 + 1;

        System.out.println("y1Max = " + y1Max);
        System.out.println("y2Max = " + y2Max);
        System.out.println("y3Max = " + y3Max);
        System.out.println("y4Max = " + y4Max);
//        long count = (x1Max - x1Min) * (x2Max - x2Min) * (x3Max - x3Min) * (x4Max - x4Min) * y1Max * y2Max * y3Max * y4Max;
//
//        System.out.println("循环次数 = "+ count);

//        int minX = 1;
        int minY = 0;
        long countNum = 0;
        int countTotal = 0;
        int result = 0;
        int x1R = 0, x2R = 0, x3R = 0, x4R = 0, y1R = 0, y2R = 0, y3R = 0, y4R = 0;
        int stR = 0, btR = 0;
        for (int x1No = x1Min; x1No <= x1Max; x1No++) {//xMax = 10
            for (int x2No = x2Min; x2No <= x2Max; x2No++) {
                for (int x3No = x3Min; x3No <= x3Max; x3No++) {
                    for (int x4No = x4Min; x4No <= x4Max; x4No++) {
                        for (int y1No = minY; y1No <= y1Max; y1No++) {
                            for (int y2No = minY; y2No <= y2Max; y2No++) {
                                for (int y3No = minY; y3No <= y3Max; y3No++) {
                                    for (int y4No = minY; y4No <= y4Max; y4No++) {
                                        countNum = countNum + 1L;
                                        if (countNum % 1000000000 == 0) {
                                            System.out.println("循环次数为：" + countNum);
                                        }
//                                        System.out.println("循环次数为："+ ++countNum);
//                                        ++countNum;
                                        int st = x1y1 * y1No + x2y2 * y2No + x3y3 * y3No + x4y4 * y4No;
                                        int bt = x1y1 * y1No * x1No + x2y2 * y2No * x2No + x3y3 * y3No * x3No + x4y4 * y4No * x4No;

                                        if (  (st<= smallTotal) && (st>= (smallTotal -276)) &&
                                                (bt <= bigTotal) && (bt >= (bigTotal -270))   ) {
//                                        if ((st == smallTotal) &&
//                                                (bt == bigTotal)) {//x= 35
//                                            System.out.println("x1No=" + x1No + " y1No=" + y1No +
//                                                    "x2No=" + x2No + " y2No=" + y2No +
//                                                    "x3No=" + x3No + " y3No=" + y3No +
//                                                    "x4No=" + x4No + " y4No=" + y4No);
                                            countTotal++;
                                            writeToFile2("x1=" + x1No + " y1=" + y1No +
                                                    " x2=" + x2No + " y2=" + y2No +
                                                    " x3=" + x3No + " y3=" + y3No +
                                                    " x4=" + x4No + " y4=" + y4No +
                                                    " st=" + st + " bt=" + bt +
                                                    "\r\n");
//                                            list.add(new DongCeng(x1No, x2No, x3No, x4No, y1No, y2No, y3No, y4No));
                                            int resultTemp = x1No * y1No * 420 * 7000 + x2No * y2No * 400 * 7500 + x3No * y3No * 270 * 8000 + x4No * y4No * 150 * 10000 ;
                                            if (resultTemp > result) {
                                                result = resultTemp;
                                                x1R = x1No;
                                                x2R = x2No;
                                                x3R = x3No;
                                                x4R = x4No;
                                                y1R = y1No;
                                                y2R = y2No;
                                                y3R = y3No;
                                                y4R = y4No;
                                                stR = st;
                                                btR = bt;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        writeToFile2("x1R=" + x1R + " y1R=" + y1R +
                " x2R=" + x2R + " y2R=" + y2R +
                " x3R=" + x3R + " y3R=" + y3R +
                " x4R=" + x4R + " y4R=" + y4R +
                " stR=" + stR + " btR=" + btR +
                " result=" + result + "\r\n");
        System.out.println("总次数 = " + countTotal);
        System.out.println("endTime = " + new Date());
        writeToFile2("总次数 = " + countTotal + "\r\n");
        writeToFile2("endTime = " + new Date() + "\r\n");
        return list;
    }



}
